package com.alb;

import java.util.Arrays;
import java.util.Scanner;

public class RedBook3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n=scanner.nextInt();
        int m=scanner.nextInt();
        String relations=scanner.next();

        int[][] dp=new int[n+1][m+1];
        for (int i = 0; i <= n; i++) {
            dp[i][0]=1;
        }
        for (int i=1;i<=n;i++){
            for(int j=1;j<=m;j++){
                if(relations.charAt(i-1)=='>'){
                    for(int k=j+1;k<=m;k++) {
                        dp[i][j] = (dp[i][j] + dp[i - 1][k])%1000000007;
                    }
                } else if (relations.charAt(i-1)=='<') {
                    for(int k=1;k<j;k++){
                        dp[i][j]=(dp[i][j]+dp[i-1][k])%1000000007;
                    }
                }else {
                    dp[i][j]=dp[i-1][j];
                }
            }
        }
        long totalPossinilities=0;
        for(int j=1;j<=m;j++){
            totalPossinilities=(totalPossinilities+dp[n][j])%1000000007;
        }
        System.out.println(totalPossinilities);
    }
}
